import dict from '@/const/dict/dict';

export default {
  height: 'auto',
  calcHeight: 30,
  tip: false,
  searchShow: true,
  border: true,
  index: true,
  viewBtn: true,
  selection: true,
  dialogClickModal: false,
  grid: false,
  gridBtn: false,
  dialogDrag: true,
  labelWidth: 100,
  defaultSort: {
    prop: 'createTime',
    order: 'ascending'
  },
  column: [
    {
      label: '主键',
      prop: 'id',
      type: 'input',
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true
    },
    {
      label: '接码平台',
      prop: 'serviceApiId',
      type: 'select',
      dicUrl: '/biz/search/select/sms-api',
      dicHeaders: { crypto: true },
      dicMethod: 'post',
      dataType: 'string',
      props: {
        label: 'dictValue',
        value: 'dictKey'
      },
      search: true,
      searchSpan: 4,
      searchLabelWidth: 100,
      rules: [{
        required: true,
        message: '请选择接码平台',
        trigger: 'blur'
      }],
      disabled: false,
      control: (val) => {
        if (val) {
          if (val === '1845443446635368450') {
            // 北美接码
            return {
              apiKey: {
                display: false
              },
              username: {
                display: true
              },
              password: {
                display: true
              }
            };
          } else {
            return {
              apiKey: {
                display: true
              },
              username: {
                display: false
              },
              password: {
                display: false
              }
            };
          }
        } else {
          return {
            apiKey: {
              display: false
            },
            username: {
              display: false
            },
            password: {
              display: false
            }
          };
        }
      }
    },
    {
      label: '名称',
      prop: 'remark',
      maxlength: 20,
      showWordLimit: true,
      rules: [{
        required: true,
        message: '请输入备注信息',
        trigger: 'blur'
      }]
    },
    {
      label: '平台账号',
      labelTip: '该数据非必填,仅限用户方便管理账号.所有敏感数据都进行加密处理',
      prop: 'platformUserName',
      type: 'input',
      showOverflowTooltip: true,
      maxlength: 50,
      showWordLimit: true,
      hide: true
    },
    {
      label: '平台密码',
      labelTip: '该数据非必填,仅限用户方便管理账号.所有敏感数据都进行加密处理',
      prop: 'platformPassword',
      type: 'input',
      showOverflowTooltip: true,
      maxlength: 50,
      showWordLimit: true,
      hide: true
    },
    {
      label: 'API-KEY/账密',
      prop: 'account',
      width: 150,
      display: false
    },
    {
      label: 'API-KEY',
      labelTip: '该数据将进行加密处理,平台不会已明文形式存储',
      prop: 'apiKey',
      type: 'input',
      showOverflowTooltip: true,
      span: 24,
      maxlength: 500,
      showWordLimit: true,
      rules: [{
        required: true,
        message: '请输入API-KEY',
        trigger: 'blur'
      }],
      display: false,
      hide: true
    },
    {
      label: '账号',
      labelTip: '该数据将进行加密处理,平台不会已明文形式存储',
      prop: 'username',
      type: 'input',
      rules: [{
        required: true,
        message: '请输入账号',
        trigger: 'blur'
      }],
      maxlength: 50,
      showWordLimit: true,
      display: false,
      hide: true
    },
    {
      label: '密码',
      labelTip: '该数据将进行加密处理,平台不会已明文形式存储',
      prop: 'password',
      type: 'input',
      rules: [{
        required: true,
        message: '请输入密码',
        trigger: 'blur'
      }],
      maxlength: 50,
      showWordLimit: true,
      display: false,
      hide: true
    },
    {
      label: '余额',
      prop: 'balance',
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false
    },
    {
      label: '创建人',
      prop: 'createUser',
      component: 'user-select',
      params: {
        checkType: 'radio'
      },
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      search: true,
      searchSpan: 4,
      searchLabelWidth: 85
    },
    {
      label: '创建时间',
      prop: 'createTime',
      type: 'datetime',
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      startPlaceholder: '开始日期',
      endPlaceholder: '结束日期',
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      search: true,
      searchRange: true,
      searchSpan: 8,
      searchOrder: 99,
      sortable: 'custom',
      width: 180
    },
    {
      label: '状态',
      prop: 'status',
      type: 'switch',
      dicData: dict.enable_disable,
      dataType: 'number',
      value: 1,
      search: true,
      searchSpan: 4,
      searchLabelWidth: 75,
      rules: [{
        required: true,
        message: '请选择状态',
        trigger: 'blur'
      }]
    }
  ]
};
